/*
 * ReturnInstruction.cpp
 *
 *  Created on: 17/nov/2010
 *      Author: computer
 */

#include "ReturnInstruction.h"

namespace TreeExpression {

ReturnInstruction::ReturnInstruction() : FlowExpression(), Expression_CRTP<ReturnInstruction>() { }

ReturnInstruction::ReturnInstruction(const ReturnInstruction& copy) : Expression(copy), FlowExpression(copy), Expression_CRTP<ReturnInstruction>(copy) { }

ReturnInstruction::~ReturnInstruction() { }

bool ReturnInstruction::isStop() const {
	return true;
}

AutoPointer<Expression> ReturnInstruction::eval(CopyPointer<Context>& context) {
	AutoPointer<Expression> ris(new ReturnInstruction());
	ris->setSon(getSon()->eval(context));
	return ris;
}

std::string ReturnInstruction::toString() const {
	std::string tmp("return ");
	tmp.append(getSon()->toString());
	return tmp;
}

}
